﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using IDAL.RF.PIM;
using Model;

namespace BLL.RF.PIM
{
    public class PIMTest_temp
    {
        private static readonly IPIMTest_temp dal = DALFactory.DataAccess.CreatePIMTest_temp();


        //用于PIM测试数据的录入
        public bool PIMTest_tempAndItem_Insert(PIMTest_tempInfo pti, IList<PIMTestItemInfo> ptiis)
        {
            DataTable dt = new DataTable();
            try
            {
                dt = CommHelper.ListToDataTable<PIMTestItemInfo>(ptiis);
                dt.Columns.Remove("ProductSN");
                dt.Columns.Remove("TestTime");
                return dal.PIMTest_tempAndItem_Insert(pti, dt);
            }
            catch
            {
                return false;
            }
            finally
            {
                dt.Dispose();
            }
        }

        public bool PIMTest_temp_DisableRecordsbySN(string productSN)
        {
            try
            {
                dal.PIMTest_temp_DisableRecordsbySN(productSN);
                return true;
            }
            catch
            {
                return false;
            }
        }

        public IList<PIMTest_tempInfo> PIMTest_temp_GetLatestbyProductSN(string sn)
        {
            return dal.PIMTest_temp_GetLatestbyProductSN(sn);
        }
    }
}
